// 接口都放在这里
import http from "./axios"
// 删除菜单
export const delMenuById = (id) => http.post('/menudelete', { id: id })
//新增菜单  //传对象
export const addMenu = (data) => http.post('/menuadd', data)
//编辑菜单
export const editMenu = (data) => http.post('/menuedit', data)

//获取角色列表
export const getRoleList = () => http('/rolelist')
// 删除角色
export const delRoleById = (id) => http.post('/roledelete', { id: id })
//新增角色  //传对象
export const addRole = (data) => http.post('/roleadd', data)
//编辑菜单
export const editRole = (data) => http.post('/roleedit', data)

//获取管理员列表
export const getuserList = (data) => http.get('/userlist', { params: data })
//获取管理员总数
export const getuserCount = () => http.get('/usercount')
//新增管理员
export const addUser = (data) => http.post('/useradd', data)
//后台管理员登录
export const userLogin = (data) => http.post('/userlogin', data)

//获取商品分类管理树
export const getcateList = () => http.get('/catelist', { params: { istree: 1 } })
// 商品分类添加
export const addCate = (data) => http.post('/cateadd', data)
// 商品分类修改
export const editCate = (data) => http.post('/cateedit', data)
// 商品分类删除
export const delCateById = (id) => http.post('/catedelete', { id: id })


// 获取商品规格列表
export const getSpecsList = () => http('/specslist', { params: { page: 1, size: 99 } })
// 新增商品规格
export const addSpecs = (data) => http.post('/specsadd', data)
// 商品规格总数（用于计算分页）
export const getspecsCount = () => http.get('/specscount')

// 获取商品列表
export const getGoodsList = () => http('/goodslist', { params: { page: 1, size: 99 } })
// 获取商品列表
// export const getGoodsList = () => http('/goodslist', { params: { page: 1, size: 99 } })
// 根据上级分类 获取下级分类
export const getCateListByTop = (data) => http('/catelist', { params: data })
// 商品添加
export const addGoods = (data) => http.post('/goodsadd', data)
// .商品删除
export const deleteGoodsById = (id) => http.post('/goodsdelete', { id: id })
// 商品修改
export const editGoods = (data) => http.post('/goodsedit', data)